package com.example;

import Dictionary.Data;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * This class provide a method to Open the help page in the default browser.
 * @author SUMEDHA
 */
public class HelpView {

    /**
     * This method opens the given web page in the default browser.
     * @param uRL  The path to the Open Office extension temporary directory
     * @throws MalformedURLException
     */
    void view(String uRL) throws MalformedURLException {
        try {
            //Path details are in Data class
            Data dt = new Data();
            //Creates the complete URL
            String helpUrl = uRL + dt.getOverView();
            //Creates a URL Object
            URL uurl = new URL(helpUrl);
            //Opens it in default browser
            Process p = Runtime.getRuntime().exec("cmd /c start " + helpUrl);
        } catch (IOException ex) {
            Logger.getLogger(HelpView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
